package test04;

public class MyArrays {
    public static String MyToString(int[] arr){
        String str="";
        for(int i=0;i<arr.length;i++){
            if(i==0){
                str+="["+arr[i]+",";
            }else if(i>0 && i<arr.length-1){
                str+=arr[i]+",";
            }else{
                str+=arr[i]+"]";
            }
        }
        return str;
    }
    public static void main(String[] args) {
        int arr[]={1,2,3,4,5};
        System.out.println(MyToString(arr));
    }
}
